Lecture 4 - Practice

Q1: Atoms Validation

حدد إذا كان كل كود من دول يعتبر Atom صحيح ولا لأ:

  1. 2340ieh
  2. george-smith
  3. Void
  4. _alpha
  5. x25
  6. x_y
  7. 'Sarah Jones'
  8. <---->
  9. anna
  10. alpha__beta_procedure

Q2: Structure Basics

اعمل structures للداتا دي باستخدام functors مناسبة:

وبعدين جرب الـ unification:


Q3: Cars Database

اعمل قاعدة بيانات للعربيات باستخدام structure car(Make, Age, Price):

واكتب الاستعلامات:


Q4: Geometric Objects

استخدم functors point, seg, triangle عشان تمثل الأشكال الهندسية دي:

وبعدين جرب الـ matching:


Q5: Tree Representation

استخدم functors عشان تمثل الـ expressions دي على شكل tree:


Q6: Vertical & Horizontal Lines

اعمل rules للخطوط:

وبعدين اكتب الاستعلامات:


Q7: Employees Database

اعمل قاعدة بيانات للموظفين باستخدام structure employee(Name, Dept, Position, Years, Salary):

وبعدين اعمل rules:

واكتب الاستعلامات:

  1. What department does Ahmed work in?
  2. What is Mona's basic salary?
  3. What is Hany's real salary?
  4. Who has been working for more than 5 years?
  5. List all employees in the Sales department.

Nour Eldeen Mahmoud


Powered by Forestry.md